//
//  HMDownloadIMGOperation.m
//  nxt.仿SD框架
//
//  Created by 倪啸天 on 16/10/15.
//  Copyright © 2016年 itheima. All rights reserved.
//

#import "HMDownloadIMGOperation.h"

@implementation HMDownloadIMGOperation

- (void)downloadAndSetIMGWithURL:(NSString *)urlString
{
    
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    
    NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{
        
        NSURL *url = [NSURL URLWithString:urlString];
        
        NSData *data = [NSData dataWithContentsOfURL:url];
        
        UIImage *image = [UIImage imageWithData:data];
        
        NSLog(@"加载OK.");
        
        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
            
            
            
        }];
        
    }];
    
    [queue addOperation:op];
    
}

- (void)main
{
    
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    
    NSBlockOperation *op = [[NSBlockOperation blockOperationWithBlock:^{

        NSURL *url = [NSURL URLWithString:self.urlString];
        
        NSData *data = [NSData dataWithContentsOfURL:url];
        
        
        
    }];
    
    [queue addOperation:op];
    
}

@end
